<%= render partial: 'roroacms/admin/partials/table_header', locals: {path: new_admin_article_path, name: t("views.admin.articles.index.add_new_article"), id: "add-new-article" } %>

<%= form_tag bulk_update_admin_articles_path do %>
  <table id="dtable" class="table table-hover" cellspacing="0" width="100%">
    <thead>
      <tr>
        <th class="checkboxth hidden-xs"><%= check_box_tag 'all', 'all', false, :id => 'check_all' %></th>
        <th><%= t("views.admin.partials.articles_table.post_title") %></th>
        <th class="hidden-xs"><%= t("views.admin.generic.published_date") %></th>
        <th>&nbsp;</th>
      </tr>
    </thead>
    <% @posts.each do |post| %>
      <tr class="<%= cycle('list_line_odd', 'list_line_even') %> <%= post.post_status == "Draft" ? 'draft' : '' %>">

        <td class="hidden-xs"><%= check_box_tag 'posts[]', post.id %></td>
      	<td><%= post.post_title %><%= post.post_status == "Draft" ? t("views.admin.partials.articles_table.draft") : '' %></td>
      	<td class="hidden-xs"><%= post.post_date.strftime "%d-%m-%Y" %></td>
        <td class="center">
          <div class="btn-group pull-right">
            <%= link_to edit_admin_article_path(post), :class => 'btn btn-xs btn-default' do %>
              <i class="fa fa-pencil"></i>
            <% end %>        
            <%= link_to page_path(post), :class => 'btn btn-xs btn-default', :target => "_blank" do %>
              <i class="fa fa-search"></i>
            <% end %>     
            <%= link_to admin_article_path(post), method: :delete, data: { confirm: t("views.admin.generic.confirm") }, :class => 'btn btn-xs btn-danger' do %>
              <i class="fa fa-trash-o"></i>
            <% end %>
          </div>
        </td>

      </tr>
    <% end %>
  </table>
  <div class="hidden-xs">
    <hr>
    <%= bulk_update_dropdown Hash[
                                'publish' => t("views.admin.generic.bulk_update_options.publish"), 
                                'draft' => t("views.admin.generic.bulk_update_options.draft"), 
                                'move_to_trash' => t("views.admin.generic.bulk_update_options.move_to_trash")
                                ] %>
  </div>
  
  <div id="paginationWrapper"></div>

<% end %>